Grid

The set grid command allows grid lines to be drawn on the plot.

Syntax:

     set grid {{no}{m}xtics} {{no}{m}ytics} {{no}{m}ztics}
              {{no}{m}x2tics} {{no}{m}y2tics}
              {polar {<angle>}}
              { {linestyle <major_linestyle>}
                | {linetype | lt <major_linetype>}
                  {linewidth | lw <major_linewidth>}
                { , {linestyle | ls <minor_linestyle>}
                    | {linetype | lt <minor_linetype>}
                      {linewidth | lw <minor_linewidth>} } }
     set nogrid
     show grid

The grid can be enabled and disabled for the major and/or minor tic marks on any axis, and the linetype and linewidth can be specified for major and minor grid lines, also via a predefined linestyle, as far as the active terminal driver supports this.

Additionally, a polar grid can be selected for 2-d plots — circles are drawn to intersect the selected tics, and radial lines are drawn at definable intervals. (The interval is given in degrees or radians ,depending on the set angles setting.) Note that a polar grid is no longer automatically generated in polar mode.

The pertinent tics must be enabled before set grid can draw them; gnuplot will quietly ignore instructions to draw grid lines at non-existent tics, but they will appear if the tics are subsequently enabled.

If no linetype is specified for the minor gridlines, the same linetype as the major gridlines is used. The default polar angle is 30 degrees.

By default, grid lines are drawn with half the usual linewidth. The major and minor linewidth specifiers scale this default value; for example, set grid lw .5 will draw grid lines with one quarter the usual linewidth.

Z grid lines are drawn on the back of the plot. This looks better if a partial box is drawn around the plot — see set border.